package com.example.reactor;

import reactor.core.publisher.Flux;

import java.util.function.Predicate;

public class Practice9 {

    public static void main(String[] args) {

        Flux.range(1, 10).
                filter(new Predicate<Integer>() {
                    @Override
                    public boolean test(Integer i) {
                        System.out.println("filter: " + i);
                        return i % 2 == 0;
                    }
                }).
                subscribe(System.out::println);

        System.out.println("---------------------------------------分割线-------------------------------------");

        // 把流中的元素与另一个流中对应元素进行合并，多余元素将被抛弃
        Flux.just(1, 2, 3, 4)
                .zipWith(Flux.just(3, 4), (s1, s2) -> s1 + "," + s2)
                .subscribe(System.out::println);


    }
}
